package com.movie.ticket.sale.authorassembly;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.web.multipart.MultipartResolver;
import org.springframework.web.multipart.commons.CommonsMultipartResolver;

@SpringBootApplication
@EnableDiscoveryClient
@EnableFeignClients("com.movie.ticket.sale")
@ComponentScan("com.movie.ticket.sale")
@MapperScan("com.movie.ticket.sale")
@EnableCaching
public class AuthorAssemblyApplication {

    public static void main(String[] args) {
        SpringApplication.run(AuthorAssemblyApplication.class, args);
    }

    /**
     * 上传文件大小配置
     * @return
     */
    @Bean
    public MultipartResolver multipartResolver() {
        CommonsMultipartResolver commonsMultipartResolver = new CommonsMultipartResolver();
        commonsMultipartResolver.setMaxUploadSize(50 * 1024 * 1024l);
        commonsMultipartResolver.setMaxUploadSizePerFile(10 * 1024 * 1024l);
        return commonsMultipartResolver;
    }
}
